package com.openatc.model.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author ：panleilei
 * @description openatc方向定义
 * @modified By：
 * @version:
 * @date ：Created in 2023/6/2 15:50
 */
public class Directions {
    public static final Integer EAST_STRAIGHT = 1; // 东直行
    public static final Integer EAST_LEFT = 2; // 东左转
    public static final Integer EAST_RIGHT = 3; // 东右转
    public static final Integer EAST_TURN = 4; // 东掉头
    public static final Integer WEST_STRAIGHT = 5; // 西直行
    public static final Integer WEST_LEFT = 6; // 西左转
    public static final Integer WEST_RIGHT = 7; // 西右转
    public static final Integer WEST_TURN = 8; // 西掉头
    public static final Integer NORTH_STRAIGHT = 9; // 北直行
    public static final Integer NORTH_LEFT = 10; // 北左转
    public static final Integer NORTH_RIGHT = 11; // 北右转
    public static final Integer NORTH_TURN = 12; // 北掉头
    public static final Integer SOUTH_STRAIGHT = 13; // 南直行
    public static final Integer SOUTH_LEFT = 14; // 南左转
    public static final Integer SOUTH_RIGHT = 15; // 南右转
    public static final Integer SOUTH_TURN = 16; // 南掉头
    public static final Integer SOUTHEAST_STRAIGHT = 17; // 东南直行
    public static final Integer SOUTHEAST_LEFT = 18; // 东南左转
    public static final Integer SOUTHEAST_RIGHT = 19; // 东南右转
    public static final Integer SOUTHEAST_TURN = 20; // 东南掉头
    public static final Integer SOUTHWEST_STRAIGHT = 21; // 西南直行
    public static final Integer SOUTHWEST_LEFT = 22; // 西南左转
    public static final Integer SOUTHWEST_RIGHT = 23; // 西南右转
    public static final Integer SOUTHWEST_TURN = 24; // 西南掉头
    public static final Integer NORTHEAST_STRAIGHT = 25; // 东北直行
    public static final Integer NORTHEAST_LEFT = 26; // 东北左转
    public static final Integer NORTHEAST_RIGHT = 27; // 东北右转
    public static final Integer NORTHEAST_TURN = 28; // 东北掉头
    public static final Integer NORTHWEST_STRAIGHT = 29; // 西北直行
    public static final Integer NORTHWEST_LEFT = 30; // 西北左转
    public static final Integer NORTHWEST_RIGHT = 31; // 西北右转
    public static final Integer NORTHWEST_TURN = 32; // 西北掉头

    public static final Integer EAST = 1; // 东向
    public static final Integer WEST = 2; // 西向
    public static final Integer SOUTH = 3; // 南向
    public static final Integer NORTH = 4; // 北向
    public static final Integer NORTHEAST = 5; // 东北向
    public static final Integer SOUTHEAST = 6; // 东南向
    public static final Integer SOUTHWEST = 7; // 西南向
    public static final Integer NORTHWEST = 8; // 西北向

    private static Map<Integer,List<Integer>> directionsMap = null;

    static {
        directionsMap = new HashMap<>(32);

        List<Integer> east = new ArrayList<>(4);
        east.add(EAST_STRAIGHT);
        east.add(EAST_LEFT);
        east.add(EAST_RIGHT);
        east.add(EAST_TURN);

        List<Integer> west = new ArrayList<>(4);
        west.add(WEST_STRAIGHT);
        west.add(WEST_LEFT);
        west.add(WEST_RIGHT);
        west.add(WEST_TURN);

        List<Integer> south = new ArrayList<>(4);
        south.add(SOUTH_STRAIGHT);
        south.add(SOUTH_LEFT);
        south.add(SOUTH_RIGHT);
        south.add(SOUTH_TURN);

        List<Integer> north = new ArrayList<>(4);
        north.add(NORTH_STRAIGHT);
        north.add(NORTH_LEFT);
        north.add(NORTH_RIGHT);
        north.add(NORTH_TURN);

        List<Integer> southeast = new ArrayList<>(4);
        southeast.add(SOUTHEAST_STRAIGHT);
        southeast.add(SOUTHEAST_LEFT);
        southeast.add(SOUTHEAST_RIGHT);
        southeast.add(SOUTHEAST_TURN);

        List<Integer> southwest = new ArrayList<>(4);
        southwest.add(SOUTHWEST_STRAIGHT);
        southwest.add(SOUTHWEST_LEFT);
        southwest.add(SOUTHWEST_RIGHT);
        southwest.add(SOUTHWEST_TURN);

        List<Integer> northeast = new ArrayList<>(4);
        northeast.add(NORTHEAST_STRAIGHT);
        northeast.add(NORTHEAST_LEFT);
        northeast.add(NORTHEAST_RIGHT);
        northeast.add(NORTHEAST_TURN);

        List<Integer> northwest = new ArrayList<>(4);
        northwest.add(NORTHWEST_STRAIGHT);
        northwest.add(NORTHWEST_LEFT);
        northwest.add(NORTHWEST_RIGHT);
        northwest.add(NORTHWEST_TURN);

        directionsMap.put(EAST,east); // 东
        directionsMap.put(WEST,west); // 西
        directionsMap.put(SOUTH,south); // 南
        directionsMap.put(NORTH,north); // 北
        directionsMap.put(NORTHEAST,northeast); // 东北
        directionsMap.put(SOUTHEAST,southeast); // 东南
        directionsMap.put(SOUTHWEST,southwest); // 西南
        directionsMap.put(NORTHWEST,northwest); // 西北

    }

    public static Map<Integer,List<Integer>> getDirectionsMap() {
        return directionsMap;
    }

    /**
     * 获取所有的方向
     * @return
     */
    public static List<Integer> getDirections() {
        return new ArrayList<>(directionsMap.keySet());
    }

}
